package swing;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

public class Demo extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public Demo() {
		setTitle("我的窗口");
		setSize(500, 500);
		setVisible(true);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		JPanel panel=new JPanel();
		panel.setLayout(new BorderLayout());
		add(panel,BorderLayout.NORTH);
		JTextField tf=new JTextField();
		JButton bt=new JButton("清除");
		panel.add(tf);panel.add(bt,BorderLayout.EAST);
	}
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			
			@Override
			public void run() {
				new Demo();
				
			}
		});

	}

}
